package part11;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author wcj
 * @Date 2021/5/20 16:50
 * @Version 1.0
 */
public class Part114 {

    public static void main(String[] args) {
        List<Snow> snow1 = Arrays.asList(new Crusty(), new Slush(), new Power());
        List<Power> powers = Arrays.asList(new Light(), new Heavy());
        ArrayList<Snow> snow3 = new ArrayList<>();
        Collections.addAll(snow3, new Light(), new Heavy());
        // 中间插入一条线索告诉Arrays.asList()产生什么类型
        // 因为Arrays.asList()会限制产生最理想的类型假设，即产生Power所继承的Power,而去产生Power
        List<Snow> snows = Arrays.<Snow>asList(new Light(), new Heavy());
    }
}

class Snow {
}

class Power extends Snow {
}

class Light extends Power {
}

class Heavy extends Power {
}

class Crusty extends Snow {
}

class Slush extends Snow {
}
